<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="static/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script><!-- 下拉框 -->
	
		
		<!-- 下拉框 -->
		<link rel="stylesheet" href="static/css/chosen.css" />
		
		
		<link rel="stylesheet" href="static/assets/css/font-awesome.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="static/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
		
		<script type="text/javascript">
	
		if("${msg}"=="success")
		{
			<%--alert("${msg}");--%>
			$(function(){
				$("#zhongxin").hide();
				$("#zhongxin3").show();
//				$("#zhongxin3").append("<input type='text'>aaaa");
			});
		}
		//继续导入
		function go_on(){
			window.location.href='<%=basePath%>title/goUploadExcel.do';
			
			}
			
			//保存
			function save(){
				if($("#excel").val()=="" || document.getElementById("excel").files[0] =='请选择xls格式的文件'){
					
					$("#excel").tips({
						side:3,
			            msg:'请选择文件',
			            bg:'#AE81FF',
			            time:3
			        });
					return false;
					
				}
				if($("#DEPARTMENT_XI").val()==""||($("#DEPARTMENT_XI").val()==null)){
					$("#DEPARTMENT_XI").tips({
						side:3,
			            msg:'请选择上传学院',
			            bg:'#AE81FF',
			            time:2
			        });
					return false;
					
				}
				
				$("#Form").submit();
				$("#zhongxin").hide();
				$("#zhongxin2").show();
			}
			
			function fileType(obj){
				var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名
			    if(fileType != '.xls'){
			    	$("#excel").tips({
						side:3,
			            msg:'请上传xls格式的文件',
			            bg:'#AE81FF',
			            time:3
			        });
			    	$("#excel").val('');
			    	document.getElementById("excel").files[0] = '请选择xls格式的文件';
			    }
			}
			
		</script>
		
	</head>
<body>				
	<form action="title/readExcel.do" name="Form" id="Form" method="post" enctype="multipart/form-data">
		<div id="zhongxin">
		<div class="center" ><h4 class="lighter block green">题目信息信息批量导入</h4></div>
		<table style="width:95%;" >
		 <tr>
				<td align="center">选择学院：</td>

				<td>
					<select <%--class="chzn-select"--%> style="width:250px" name="DEPARTMENT_XI" id="DEPARTMENT_XI" value="${pd.DEPARTMENT_XI}" data-placeholder="院系...">
						<option value="">请选择上传学院</option>
						<c:forEach items="${roleList1}" var="role">
					<option value="${role.BIANMA}">${role.NAME}</option>
						</c:forEach>
					</select>
				</td>
				</tr>
			
			<tr>
				<td style="width:300px" colspan="3"><input type="file" id="excel" name="excel" style="width:50px;" onchange="fileType(this)" /></td>
			</tr>
			<tr>
					<td style="width:300px" colspan="3" align=center >
					
					<br>
						<input name="OVERLAP" type="radio" value="true" checked="checked"/><span class="lbl" > 覆盖重复数据</span>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input name="OVERLAP" type="radio" value="false" /><span class="lbl"> 不覆盖重复数据</span>
						
					</td>
				</tr>
			<tr>
				<td style="text-align: center" colspan="3">
					<a class="btn btn-mini btn-primary" onclick="save();">导入</a>
					<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
					<a class="btn btn-mini btn-success" onclick="window.location.href='<%=basePath%>/title/downExcel.do'">下载模版</a>
				</td>
			</tr>
			
		</table>
		</div>
		
		<div id="zhongxin2" class="center" style="display:none"><br/><img src="static/images/jzx.gif" /><br/><h4 class="lighter block green"></h4></div>
		<div id="zhongxin3" class="center" style="display:none">
		<br>
		<font size="6px">题目信息导入成功<font color="red">${successCount}</font>条，失败或重复不可写<font color="red">${failCount}</font>条</font>
				<br><font size="6px">导师信息导入成功<font color="red">${successCounte}</font>条，失败或重复不可写<font color="red">${failCounte}</font>条</font>
		
		<br>
		<br>
		<br>
		 <a class="btn btn-mini btn-primary" onclick="go_on();">继续导入</a>&nbsp;&nbsp;&nbsp;&nbsp;
   		 <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
	</div>
	</form>
	
	
		<!-- 引入 -->
		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='static/assets/js/jquery.js'>"+"<"+"/script>");
		</script>
		<!-- <![endif]-->
		<!--[if IE]>
		<script type="text/javascript">
		 	window.jQuery || document.write("<script src='static/assets/js/jquery1x.js'>"+"<"+"/script>");
		</script>
		<![endif]-->
		<script src="static/js/bootstrap.min.js"></script>
		<!-- ace scripts -->
		<script src="static/assets/js/ace/elements.fileinput.js"></script>
		<script src="static/assets/js/ace/ace.js"></script>
		<!--提示框-->
		<script type="text/javascript" src="static/js/jquery.tips.js"></script>
		<script type="text/javascript">
		$(top.hangge());
		$(function() {
			//上传
			$('#excel').ace_file_input({
				no_file:'请选择EXCEL ...',
				btn_choose:'选择',
				btn_change:'更改',
				droppable:false,
				onchange:null,
				thumbnail:false, //| true | large
				whitelist:'xls|xls',
				blacklist:'gif|png|jpg|jpeg'
				//onchange:''
				//
			});
			
		});
		
		</script>
	
</body>
</html>